package com.yiren.backstage.currency.bean;

import android.content.Context;

import com.yiren.backstage.currency.enums.GpsStateEnum;

import java.io.Serializable;

/**
 * @author lwb
 * @date :2021/12/6 10:25
 * @description: GPS对象
 */
public class GpsInfoBean implements Serializable, Cloneable {

    private static final long serialVersionUID = 6300256488078530355L;
    private static GpsInfoBean single = new GpsInfoBean();

    public static GpsInfoBean getInstance() {
        return single;
    }

    /*** 上次GPS信息 */
    public static GpsInfoBean lastGpsInfo;
    /*** 内置定位状态 */
    private GpsStateEnum internalLocationState;
    /*** 外置定位状态 */
    private GpsStateEnum externalLocationState;
    /*** 速度 */
    private float speed;
    /*** 经度 */
    private double longitude;
    /*** 纬度 */
    private double latitude;
    /*** 高度 */
    private double altitude;
    /*** 差分方位角(前后天线方向 :由后天线指向前天线). */
    private float azimuth;
    /*** 速度角 方位 */
    private float bearing;
    /*** 俯仰角 */
    private float anglePitch;
    /*** 差分（后天线）：卫星定位状态 */
    private int statusPosition;
    /*** 差分（前天线）：卫星定向状态 */
    private int statusDirection;
    /*** 差分前天线可用卫星数 */
    private int satelliteFront;
    /*** 差分后天线可用卫星数 */
    private int satelliteBack;
    /*** 差分东向位置坐标 */
    private float distanceX;
    /*** 差分北向位置坐标 */
    private float distanceY;
    /*** 差分天向位置坐标 */
    private float distanceZ;
    /*** 差分东向速度 */
    private float velocityX;
    /*** 差分北向速度 */
    private float velocityY;
    /*** 差分天向速度 */
    private float velocityZ;
    /*** 信号质量 */
    private String signalQuality;
    /*** 卫星数 */
    private int satelliteNum;
    /*** 海平面 */
    private String seaLevel;
    /*** 错误信息 */
    private String errorMessage;
    /*** K码 */
    private String kCode;
    /*** 偏磁角 */
    private String magnetic;
    /*** 模式 */
    private String workMode;
    /*** 时间 */
    private String utcDateTime;
    /*** 信噪比 */
    private float snr;
    /*** 编号 */
    private int prn;
    /*** 高度角 */
    private float elevation;
    /*** 总里程 */
    private float totalMileage;
    /*** 度数方向信息 */
    private String degreeBearingInfo;
    /*** 省份 */
    private String province;
    /*** 城市 */
    private String city;
    /*** 区县 */
    private String area;
    /*** 街道 */
    private String street;
    /*** 区县 */
    private float radius;
    /*** 方向 */
    private float direction;
    /*** 地址 */
    private String address;
    /*** 城市选择器ID */
    private String cityId;

    public float getRadius() {
        return radius;
    }

    public void setRadius(float radius) {
        this.radius = radius;
    }

    public float getDirection() {
        return direction;
    }

    public void setDirection(float direction) {
        this.direction = direction;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public GpsInfoBean() {
        super();
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getCityId() {
        return cityId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public GpsStateEnum getInternalLocationState() {
        return internalLocationState;
    }

    public void setInternalLocationState(GpsStateEnum internalLocationState) {
        this.internalLocationState = internalLocationState;
    }

    public GpsStateEnum getExternalLocationState() {
        return externalLocationState;
    }

    public void setExternalLocationState(GpsStateEnum externalLocationState) {
        this.externalLocationState = externalLocationState;
    }

    /**
     * Instantiates a new gps info.
     *
     * @param longitude the longitude
     * @param latitude  the latitude
     */
    public GpsInfoBean(double longitude, double latitude) {
        super();
        this.longitude = longitude;
        this.latitude = latitude;
    }

    @Override
    public Object clone() {
        try {
            return super.clone();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 详细描述.
     *
     * @return the string
     */
    public String detailDescribe() {
        String appendLine = "\r\n";
        /*
         * return "GPS状态:" + (isLocationSuccess() ? "定位成功" : "正在定位...") +
         * "卫星编号：" + getPrn() + appendLine + "卫星颗数：" + getSatelliteNum() +
         * appendLine + "信噪比：" + getSnr() + appendLine + "方位角：" + getAzimuth()
         * + appendLine + "高度角：" + getElevation() + appendLine + "经度：" +
         * getLongitude() + appendLine + "纬度：" + getLatitude() + appendLine +
         * // "海平面：" + SeaLevel + appendLine + // "信号质量：" + SignalQuality +
         * appendLine + "速度：" + getSpeed() + appendLine + "方位：" + getBearing()
         * + appendLine + // "模式：" + WorkMode + appendLine + "时间：" +
         * getUtcDateTime() + appendLine + // "K码：" + KCode + appendLine +
         * "错误消息：" + getErrorMessage() + appendLine + "串口数据：" +
         * getReportData();
         */
        return "";
    }

    /**
     * 判断GPS是否定位成功.
     *
     * @return true, if is location success
     */
    public boolean isLocationSuccess(Context mContext) {
//        if (null == DbConstant.userInfo) {
//            return false;
//        }
//        if (DeviceConfigurationG.IS_INTERNAL_GPS) {
//            if (getInternalLocationState() == GpsStateEnum.LOCATION_SUCCESS) {
//                return true;
//            }
//        } else {
//            if (getExternalLocationState() == GpsStateEnum.LOCATION_SUCCESS) {
        return true;
//            }
//        }
//        return false;
    }

    public void setLocation(double longitude, double latitude) {
        this.longitude = longitude;
        this.latitude = latitude;
    }

    /**
     * 取值- 经度.
     *
     * @return the 经度
     */
    public double getLongitude() {
        return longitude;
    }

    /**
     * 赋值- 经度.
     *
     * @param longitude the new 经度
     */
    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    /**
     * 取值- 纬度.
     *
     * @return the 纬度
     */
    public double getLatitude() {
        return latitude;
    }

    /**
     * 赋值- 纬度.
     *
     * @param latitude the new 纬度
     */
    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    /**
     * 取值- 信号质量.
     *
     * @return the 信号质量
     */
    public String getSignalQuality() {
        return signalQuality;
    }

    /**
     * 赋值- 信号质量.
     *
     * @param signalQuality the new 信号质量
     */
    public void setSignalQuality(String signalQuality) {
        this.signalQuality = signalQuality;
    }

    /**
     * 取值- 卫星数.
     *
     * @return the 卫星数
     */
    public int getSatelliteNum() {
        return satelliteNum;
    }

    /**
     * 赋值- 卫星数.
     *
     * @param satelliteNum the new 卫星数
     */
    public void setSatelliteNum(int satelliteNum) {
        this.satelliteNum = satelliteNum;
    }

    /**
     * 取值- 海平面.
     *
     * @return the 海平面
     */
    public String getSeaLevel() {
        return seaLevel;
    }

    /**
     * 赋值- 海平面.
     *
     * @param seaLevel the new 海平面
     */
    public void setSeaLevel(String seaLevel) {
        this.seaLevel = seaLevel;
    }

    /**
     * 取值- 错误信息.
     *
     * @return the 错误信息
     */
    public String getErrorMessage() {
        return errorMessage;
    }

    /**
     * 赋值- 错误信息.
     *
     * @param errorMessage the new 错误信息
     */
    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    /**
     * 取值- 速度.
     *
     * @return the 速度
     */
    public float getSpeed() {
        if (speed > 80) {
            //解决低精度定位时里程乱跳的问题
            speed = 0;
        }
        return speed;
    }

    /**
     * 赋值- 速度.
     *
     * @param speed the new 速度
     */
    public void setSpeed(float speed) {
        this.speed = speed;
    }

    /**
     * Gets the k code.
     *
     * @return the k code
     */
    public String getkCode() {
        return kCode;
    }

    /**
     * Sets the k code.
     *
     * @param kCode the new k code
     */
    public void setkCode(String kCode) {
        this.kCode = kCode;
    }

    /**
     * 取值- 方位.
     *
     * @return the 方位
     */
    public float getBearing() {
        return bearing;
    }

    /**
     * 赋值- 方位.
     *
     * @param bearing the new 方位
     */
    public void setBearing(float bearing) {
        this.bearing = bearing;
    }

    /**
     * 取值- 偏磁角.
     *
     * @return the 偏磁角
     */
    public String getMagnetic() {
        return magnetic;
    }

    /**
     * 赋值- 偏磁角.
     *
     * @param magnetic the new 偏磁角
     */
    public void setMagnetic(String magnetic) {
        this.magnetic = magnetic;
    }

    /**
     * 取值- 模式.
     *
     * @return the 模式
     */
    public String getWorkMode() {
        return workMode;
    }

    /**
     * 赋值- 模式.
     *
     * @param workMode the new 模式
     */
    public void setWorkMode(String workMode) {
        this.workMode = workMode;
    }


    /**
     * 取值- 时间.
     *
     * @return the 时间
     */
    public String getUtcDateTime() {
        return utcDateTime;
    }

    /**
     * 赋值- 时间.
     *
     * @param utcDateTime the new 时间
     */
    public void setUtcDateTime(String utcDateTime) {
        this.utcDateTime = utcDateTime;
    }

    /**
     * 取值- 高度.
     *
     * @return the 高度
     */
    public double getAltitude() {
        return altitude;
    }

    /**
     * 赋值- 高度.
     *
     * @param altitude the new 高度
     */
    public void setAltitude(double altitude) {
        this.altitude = altitude;
    }

    /**
     * 取值- 信噪比.
     *
     * @return the 信噪比
     */
    public float getSnr() {
        return snr;
    }

    /**
     * 赋值- 信噪比.
     *
     * @param snr the new 信噪比
     */
    public void setSnr(float snr) {
        this.snr = snr;
    }

    /**
     * 取值- 编号.
     *
     * @return the 编号
     */
    public int getPrn() {
        return prn;
    }

    /**
     * 赋值- 编号.
     *
     * @param prn the new 编号
     */
    public void setPrn(int prn) {
        this.prn = prn;
    }

    /**
     * 取值- 高度角.
     *
     * @return the 高度角
     */
    public float getElevation() {
        return elevation;
    }

    /**
     * 赋值- 高度角.
     *
     * @param elevation the new 高度角
     */
    public void setElevation(float elevation) {
        this.elevation = elevation;
    }

    /**
     * 取值- 定位最大丢失次数.
     *
     * @return the 定位最大丢失次数
     */
    public static GpsInfoBean getLastGpsInfo() {
        return lastGpsInfo;
    }

    /**
     * 赋值- 定位最大丢失次数.
     *
     * @param lastGpsInfo the new 定位最大丢失次数
     */
    public static void setLastGpsInfo(GpsInfoBean lastGpsInfo) {
        GpsInfoBean.lastGpsInfo = lastGpsInfo;
    }

    /**
     * 取值- 总里程.
     *
     * @return the 总里程
     */
    public float getTotalMileage() {
        return totalMileage;
    }

    /**
     * 赋值- 总里程.
     *
     * @param totalMileage the new 总里程
     */
    public void setTotalMileage(float totalMileage) {
        this.totalMileage = totalMileage;
    }

    /**
     * 取值- 度数方向信息.
     *
     * @return the 度数方向信息
     */
    public String getDegreeBearingInfo() {
        return degreeBearingInfo;
    }

    /**
     * 赋值- 度数方向信息.
     *
     * @param degreeBearingInfo the new 度数方向信息
     */
    public void setDegreeBearingInfo(String degreeBearingInfo) {
        this.degreeBearingInfo = degreeBearingInfo;
    }

    public float getAzimuth() {
        return azimuth;
    }

    public void setAzimuth(float azimuth) {
        this.azimuth = azimuth;
    }

    public float getAnglePitch() {
        return anglePitch;
    }

    public void setAnglePitch(float anglePitch) {
        this.anglePitch = anglePitch;
    }

    public int getStatusPosition() {
        return statusPosition;
    }

    public void setStatusPosition(int statusPosition) {
        this.statusPosition = statusPosition;
    }

    public int getStatusDirection() {
        return statusDirection;
    }

    public void setStatusDirection(int statusDirection) {
        this.statusDirection = statusDirection;
    }

    public int getSatelliteFront() {
        return satelliteFront;
    }

    public void setSatelliteFront(int satelliteFront) {
        this.satelliteFront = satelliteFront;
    }

    public int getSatelliteBack() {
        return satelliteBack;
    }

    public void setSatelliteBack(int satelliteBack) {
        this.satelliteBack = satelliteBack;
    }

    public float getDistanceX() {
        return distanceX;
    }

    public void setDistanceXY(float distanceX, float distanceY) {
        this.distanceX = distanceX;
        this.distanceY = distanceY;
    }

    public void setDistanceX(float distanceX) {
        this.distanceX = distanceX;
    }

    public float getDistanceY() {
        return distanceY;
    }

    public void setDistanceY(float distanceY) {
        this.distanceY = distanceY;
    }

    public float getDistanceZ() {
        return distanceZ;
    }

    public void setDistanceZ(float distanceZ) {
        this.distanceZ = distanceZ;
    }

    public float getVelocityX() {
        return velocityX;
    }

    public void setVelocityX(float velocityX) {
        this.velocityX = velocityX;
    }

    public float getVelocityY() {
        return velocityY;
    }

    public void setVelocityY(float velocityY) {
        this.velocityY = velocityY;
    }

    public float getVelocityZ() {
        return velocityZ;
    }

    public void setVelocityZ(float velocityZ) {
        this.velocityZ = velocityZ;
    }
}